package com.classify.test;

import com.classify.textClassify.ClassifyModel;
import com.classify.textClassify.naiveBayes.NaiveBayesClassifier;
import com.classify.word.WordSegmenter;
//import com.classify.word.character.SingleCharacter;
import com.classify.word.rmm.Rmm;
import com.classify.word.mm.MM;

public class ClassifierFactory {

	public final static String NAIVEBAYES = "naivebayes";	//贝叶斯
	public final static String COSINES = "cosine";	//余弦
	public final static String LR = "lr";	//逻辑回归
	
	public final static String MM = "mm";
	public final static String RMM = "rmm";
	public final static String sw = "sw";
	
	String seedsDir;
	
	public ClassifierFactory(String seedsDir) {
		this.seedsDir = seedsDir;
	}
	
	public ClassifyModel getClassifyModel(String modelName, String segmenterName) {
		WordSegmenter seg = getWordSegmenter(segmenterName);
		
		if(modelName.toLowerCase().equals(NAIVEBAYES)) {
			return new NaiveBayesClassifier(seg);
		}
		return null;
	}
	
	private WordSegmenter getWordSegmenter(String segmenterName) {
		WordSegmenter seg = null;
		if(segmenterName.equals(MM)) {
			seg = new MM();
		} else if(segmenterName.equals(RMM)) {
			seg = new Rmm();
		} else if(segmenterName.equals(sw)) {
//			seg = new SingleCharacter();
		}
		
		return seg;
	}
}
